package com.yisen.strategy;

import java.util.Arrays;

public class Main {
    public static void main(String[] args) {
        Dog[] arr = {new Dog(3,3),new Dog(1,1),new Dog(5,5)};
        Sorter sorter = new Sorter();
        arr = (Dog[]) sorter.sort(arr,((o1, o2) -> {
            Dog dog1 = (Dog) o1;
            Dog dog2 = (Dog) o2;
            if (dog1.height - dog2.height<0) return -1;
            else if (dog1.height - dog2.height>0) return 1;
            else return 0;
        }));
        System.out.println(Arrays.toString(arr));
    }
}
